import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../common/ObjCreate";
import { SMarryBless } from "../../../../../Message/Public/SMarryBless";
import { DateParser } from "../../../../common/tools/DateParser";
import { EMarryBlessType } from "../../../../../Message/Game/EMarryBlessType";
import { ItemData } from "../../../resource/info/ItemData";
import { Language } from "../../../../../extend/language/Language";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
//class BlessHistoryCell
    
    export  class BlessHistoryCell extends CellRenderer
    {
        constructor()
        {
            super();
            this.initStyles();
            this.initView();
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("overSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap("Friend_over"));
            return;
        }

        /* internal  */initView(): void
        {
            var loc1=GlobalStyle.textFormat1;
            loc1.leading = 6;
            this._tfDes = ObjCreate.createTextField("", 0, 0, 142, 58, this, loc1);
            this._tfDes.multiline = true;
            this._tfDes.wordWrap = true;
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "smarrybless") 
            {
                this._marryBless = arg1 as SMarryBless;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            var loc3=null;
            var loc1="";
            var loc2=DateParser.parse(this._marryBless.createDt, "hh: mm: ss");
            if (this._marryBless.blessType != EMarryBlessType._EMarryBlessCoin) 
            {
                loc3 = new ItemData(this._marryBless.num);
                loc1 = Language.getStringByParam(43530, loc2, this._marryBless.fromPlayerName, this._marryBless.toPlayerName, ItemsUtil.getItemName(loc3));
            }
            else 
            {
                loc1 = Language.getStringByParam(43530, loc2, this._marryBless.fromPlayerName, this._marryBless.toPlayerName, this._marryBless.num.toString() + Language.getString(43531));
            }
            this._tfDes.htmlText = loc1;
            return;
        }

        /* internal */ /* var */_tfDes: Object /* flash.text.TextField */;

        /* internal */ /* var */_marryBless: SMarryBless;
    }
